

for k,v in pairs(load_excel('物品数据.xlsx','道具')) do
    local k = v.name
    v.name = k
    v.item_type = 'charged'
    v.auto_merge = true
    v.base_tip = ('%s|n|n|cff999999%s|r'):format(v['效果'],v['灰字介绍'])
    v.tip = v.base_tip
    v.sell_tip = [[|cffff0000（每个玩家限购1次）|r|n|n'base_tip']]
    v.sell_tip = [['base_tip']]
    v.like_item = true
    v.stockRegen = 9999
    if k=='彩票' then
        v.item_type = 'powerup'
    end
    if k=='龙蛋' then
        v.charges = 1000
    end
    ac.lni('item',k,v)
    ac.item(k)(v)
end

local zk_weight = {
    {[[ui\折扣\1.tga]],1},
    {[[ui\折扣\2.tga]],2},
    {[[ui\折扣\3.tga]],4},
    {[[ui\折扣\4.tga]],4},
    {[[ui\折扣\5.tga]],4},
    {[[ui\折扣\6.tga]],10},
    {[[ui\折扣\7.tga]],10},
    {[[ui\折扣\8.tga]],15},
    {[[ui\折扣\9.tga]],20},
    {'',30}
}

ac.game:event '单位-添加技能'(function(_,unit, skill)
    if skill.item_class=='黑市' then
        local art,lv = table.get_by_weight(zk_weight)
        if ac.lock_shop then
            lv = ac.lock_shop
            art = zk_weight[lv][1]
        end
        if lv<10 then
            skill.exiocn = art
            skill.gold = (skill.gold or 0) * lv*0.1
            skill.lum = (skill.lum or 0) * lv*0.1
            skill.food = (skill.food or 0) * lv*0.1
        end
    end
end)

ac.game:event '玩家-购买商品'(function(_,player, skill, buyer, shop)
    if skill.item_class=='黑市' then
        skill:remove()
    end
end)